home *** CD-ROM | disk | FTP | other *** search
/ Aminet 5 / Aminet 5 - March 1995.iso / Aminet / util / gnu / a2_0bEmacs_bin.lha / Emacs-19.25 / info / emacs-10 (.txt) < prev    next >
GNU Info File  |  1992-02-21  |  50KB  |  884 lines

  1. This is Info file ../info/emacs, produced by Makeinfo-1.43 from the
  2. input file emacs.tex.
  3.    This file documents the GNU Emacs editor.
  4.    Copyright (C) 1985, 1986, 1988 Richard M. Stallman.
  5.    Permission is granted to make and distribute verbatim copies of
  6. this manual provided the copyright notice and this permission notice
  7. are preserved on all copies.
  8.    Permission is granted to copy and distribute modified versions of
  9. this manual under the conditions for verbatim copying, provided also
  10. that the sections entitled "The GNU Manifesto", "Distribution" and "GNU
  11. General Public License" are included exactly as in the original, and
  12. provided that the entire resulting derived work is distributed under
  13. the terms of a permission notice identical to this one.
  14.    Permission is granted to copy and distribute translations of this
  15. manual into another language, under the above conditions for modified
  16. versions, except that the sections entitled "The GNU Manifesto",
  17. "Distribution" and "GNU General Public License" may be included in a
  18. translation approved by the author instead of in the original English.
  19. File: emacs,  Node: Rmail Deletion,  Next: Rmail Inbox,  Prev: Rmail Motion,  Up: Rmail
  20. Deleting Messages
  21. =================
  22.    When you no longer need to keep a message, you can "delete" it. 
  23. This flags it as ignorable, and some Rmail commands will pretend it is
  24. no longer present; but it still has its place in the Rmail file, and
  25. still has its message number.
  26.    "Expunging" the Rmail file actually removes the deleted messages. 
  27. The remaining messages are renumbered consecutively.  Expunging is the
  28. only action that changes the message number of any message, except for
  29. undigestifying (*note Rmail Digest::.).
  30.      Delete the current message, and move to the next nondeleted
  31.      message (`rmail-delete-forward').
  32. `C-d'
  33.      Delete the current message, and move to the previous nondeleted
  34.      message (`rmail-delete-backward').
  35.      Undelete the current message, or move back to a deleted message
  36.      and undelete it (`rmail-undelete-previous-message').
  37.      Expunge the Rmail file (`rmail-expunge').  These two commands are
  38.      synonyms.
  39.    There are two Rmail commands for deleting messages.  Both delete the
  40. current message and select another message.  `d'
  41. (`rmail-delete-forward') moves to the following message, skipping
  42. messages already deleted, while `C-d' (`rmail-delete-backward') moves
  43. to the previous nondeleted message.  If there is no nondeleted message
  44. to move to in the specified direction, the message that was just
  45. deleted remains current.
  46.    To make all the deleted messages finally vanish from the Rmail file,
  47. type `e' (`rmail-expunge').  Until you do this, you can still
  48. "undelete" the deleted messages.
  49.    To undelete, type `u' (`rmail-undelete-previous-message'), which is
  50. designed to cancel the effect of a `d' command (usually).  It
  51. undeletes the current message if the current message is deleted. 
  52. Otherwise it moves backward to previous messages until a deleted
  53. message is found, and undeletes that message.
  54.    You can usually undo a `d' with a `u' because the `u' moves back to
  55. and undeletes the message that the `d' deleted.  But this does not
  56. work when the `d' skips a few already-deleted messages that follow the
  57. message being deleted; then the `u' command will undelete the last of
  58. the messages that were skipped.  There is no clean way to avoid this
  59. problem.  However, by repeating the `u' command, you can eventually get
  60. back to the message that you intended to undelete.  You can also reach
  61. that message with `M-p' commands and then type `u'.
  62.    A deleted message has the `deleted' attribute, and as a result
  63. `deleted' appears in the mode line when the current message is
  64. deleted.  In fact, deleting or undeleting a message is nothing more
  65. than adding or removing this attribute.  *Note Rmail Labels::.
  66. File: emacs,  Node: Rmail Inbox,  Next: Rmail Files,  Prev: Rmail Deletion,  Up: Rmail
  67. Rmail Files and Inboxes
  68. =======================
  69.    Unix places incoming mail for you in a file that we call your
  70. "inbox".  When you start up Rmail, it copies the new messages from
  71. your inbox into your primary mail file, an Rmail file, which also
  72. contains other messages saved from previous Rmail sessions.  It is in
  73. this file that you actually read the mail with Rmail.  This operation
  74. is called "getting new mail".  It can be repeated at any time using
  75. the `g' key in Rmail.  The inbox file name is
  76. `/usr/spool/mail/USERNAME' in Berkeley Unix, `/usr/mail/USERNAME' in
  77. system V.
  78.    There are two reason for having separate Rmail files and inboxes.
  79.   1. The format in which Unix delivers the mail in the inbox is not
  80.      adequate for Rmail mail storage.  It has no way to record
  81.      attributes (such as `deleted') or user-specified labels; it has
  82.      no way to record old headers and reformatted headers; it has no
  83.      way to record cached summary line information.
  84.   2. It is very cumbersome to access an inbox file without danger of
  85.      losing mail, because it is necessary to interlock with mail
  86.      delivery.  Moreover, different Unix systems use different
  87.      interlocking techniques.  The strategy of moving mail out of the
  88.      inbox once and for all into a separate Rmail file avoids the need
  89.      for interlocking in all the rest of Rmail, since only Rmail
  90.      operates on the Rmail file.
  91.    When getting new mail, Rmail first copies the new mail from the
  92. inbox file to the Rmail file; then it saves the Rmail file; then it
  93. deletes the inbox file.  This way, a system crash may cause
  94. duplication of mail between the inbox and the Rmail file, but cannot
  95. lose mail.
  96.    Copying mail from an inbox in the system's mailer directory
  97. actually puts it in an intermediate file `~/.newmail'.  This is
  98. because the interlocking is done by a C program that copies to another
  99. file.  `~/.newmail' is deleted after mail merging is successful.  If
  100. there is a crash at the wrong time, this file will continue to exist
  101. and will be used as an inbox the next time you get new mail.
  102. File: emacs,  Node: Rmail Files,  Next: Rmail Output,  Prev: Rmail Inbox,  Up: Rmail
  103. Multiple Mail Files
  104. ===================
  105.    Rmail operates by default on your "primary mail file", which is
  106. named `~/RMAIL' and receives your incoming mail from your system inbox
  107. file.  But you can also have other mail files and edit them with
  108. Rmail.  These files can receive mail through their own inboxes, or you
  109. can move messages into them by explicit command in Rmail (*note Rmail
  110. Output::.).
  111. `i FILE RET'
  112.      Read FILE into Emacs and run Rmail on it (`rmail-input').
  113. `M-x set-rmail-inbox-list RET FILES RET'
  114.      Specify inbox file names for current Rmail file to get mail from.
  115.      Merge new mail from current Rmail file's inboxes
  116.      (`rmail-get-new-mail').
  117. `C-u g FILE'
  118.      Merge new mail from inbox file FILE.
  119.    To run Rmail on a file other than your primary mail file, you may
  120. use the `i' (`rmail-input') command in Rmail.  This visits the file,
  121. puts it in Rmail mode, and then gets new mail from the file's inboxes
  122. if any.  You can also use `M-x rmail-input' even when not in Rmail.
  123.    The file you read with `i' does not have to be in Rmail file format. 
  124. It could also be Unix mail format, or mmdf format; or it could be a
  125. mixture of all three, as long as each message belongs to one of the
  126. three formats.  Rmail recognizes all three and converts all the
  127. messages to proper Rmail format before showing you the file.
  128.    Each Rmail file can contain a list of inbox file names; you can
  129. specify this list with `M-x set-rmail-inbox-list RET FILES RET'.  The
  130. argument can contain any number of file names, separated by commas. 
  131. It can also be empty, which specifies that this file should have no
  132. inboxes.  Once a list of inboxes is specified, the Rmail file
  133. remembers it permanently until it is explicitly changed.
  134.    If an Rmail file has inboxes, new mail is merged in from the
  135. inboxes when the Rmail file is brought into Rmail, and when the `g'
  136. (`rmail-get-new-mail') command is used.  If the Rmail file specifies
  137. no inboxes, then no new mail is merged in at these times.  A special
  138. exception is made for your primary mail file in using the standard
  139. system inbox for it if it does not specify any.
  140.    To merge mail from a file that is not the usual inbox, give the `g'
  141. key a numeric argument, as in `C-u g'.  Then it reads a file name and
  142. merges mail from that file.  The inbox file is not deleted or changed
  143. in any way when `g' with an argument is used.  This is, therefore, a
  144. general way of merging one file of messages into another.
  145. File: emacs,  Node: Rmail Output,  Next: Rmail Labels,  Prev: Rmail Files,  Up: Rmail
  146. Copying Messages Out to Files
  147. =============================
  148. `o FILE RET'
  149.      Append a copy of the current message to the file FILE, writing it
  150.      in Rmail file format (`rmail-output-to-rmail-file').
  151. `C-o FILE RET'
  152.      Append a copy of the current message to the file FILE, writing it
  153.      in Unix mail file format (`rmail-output').
  154.    If an Rmail file has no inboxes, how does it get anything in it?  By
  155. explicit `o' commands.
  156.    `o' (`rmail-output-to-rmail-file') appends the current message in
  157. Rmail format to the end of the specified file.  This is the best
  158. command to use to move messages between Rmail files.  If the other
  159. Rmail file is currently visited, the copying is done into the other
  160. file's Emacs buffer instead.  You should eventually save it on disk.
  161.    The `C-o' (`rmail-output') command in Rmail appends a copy of the
  162. current message to a specified file, in Unix mail file format.  This
  163. is useful for moving messages into files to be read by other mail
  164. processors that do not understand Rmail format.
  165.    Copying a message with `o' or `C-o' gives the original copy of the
  166. message the `filed' attribute, so that `filed' appears in the mode
  167. line when such a message is current.
  168.    Normally you should use only `o' to output messages to other Rmail
  169. files, never `C-o'.  But it is also safe if you always use `C-o',
  170. never `o'.  When a file is visited in Rmail, the last message is
  171. checked, and if it is in Unix format, the entire file is scanned and
  172. all Unix-format messages are converted to Rmail format.  (The reason
  173. for checking the last message is that scanning the file is slow and
  174. most Rmail files have only Rmail format messages.)  If you use `C-o'
  175. consistently, the last message is sure to be in Unix format, so Rmail
  176. will convert all messages properly.
  177.    The case where you might want to use `C-o' always, instead of `o'
  178. always, is when you or other users want to append mail to the same file
  179. from other mail processors.  Other mail processors probably do not know
  180. Rmail format but do know Unix format.
  181.    In any case, always use `o' to add to an Rmail file that is being
  182. visited in Rmail.  Adding messages with `C-o' to the actual disk file
  183. will trigger a "simultaneous editing" warning when you ask to save the
  184. Emacs buffer, and will be lost if you do save.
  185. File: emacs,  Node: Rmail Labels,  Next: Rmail Summary,  Prev: Rmail Output,  Up: Rmail
  186. Labels
  187. ======
  188.    Each message can have various "labels" assigned to it as a means of
  189. classification.  A label has a name; different names mean different
  190. labels.  Any given label is either present or absent on a particular
  191. message.  A few label names have standard meanings and are given to
  192. messages automatically by Rmail when appropriate; these special labels
  193. are called "attributes".  All other labels are assigned by the user.
  194. `a LABEL RET'
  195.      Assign the label LABEL to the current message (`rmail-add-label').
  196. `k LABEL RET'
  197.      Remove the label LABEL from the current message
  198.      (`rmail-kill-label').
  199. `C-M-n LABELS RET'
  200.      Move to the next message that has one of the labels LABELS
  201.      (`rmail-next-labeled-message').
  202. `C-M-p LABELS RET'
  203.      Move to the previous message that has one of the labels LABELS
  204.      (`rmail-previous-labeled-message').
  205. `C-M-l LABELS RET'
  206.      Make a summary of all messages containing any of the labels LABELS
  207.      (`rmail-summary-by-labels').
  208. Specifying an empty string for one these commands means to use the last
  209. label specified for any of these commands.
  210.    The `a' (`rmail-add-label') and `k' (`rmail-kill-label') commands
  211. allow you to assign or remove any label on the current message.  If
  212. the LABEL argument is empty, it means to assign or remove the same
  213. label most recently assigned or removed.
  214.    Once you have given messages labels to classify them as you wish,
  215. there are two ways to use the labels: in moving and in summaries.
  216.    The command `C-M-n LABELS RET' (`rmail-next-labeled-message') moves
  217. to the next message that has one of the labels LABELS.  LABELS is one
  218. or more label names, separated by commas.  `C-M-p'
  219. (`rmail-previous-labeled-message') is similar, but moves backwards to
  220. previous messages.  A preceding numeric argument to either one serves
  221. as a repeat count.
  222.    The command `C-M-l LABELS RET' (`rmail-summary-by-labels') displays
  223. a summary containing only the messages that have at least one of a
  224. specified set of messages.  The argument LABELS is one or more label
  225. names, separated by commas.  *Note Rmail Summary::, for information on
  226. summaries.
  227.    If the LABELS argument to `C-M-n', `C-M-p' or `C-M-l' is empty, it
  228. means to use the last set of labels specified for any of these
  229. commands.
  230.    Some labels such as `deleted' and `filed' have built-in meanings and
  231. are assigned to or removed from messages automatically at appropriate
  232. times; these labels are called "attributes".  Here is a list of Rmail
  233. attributes:
  234. `unseen'
  235.      Means the message has never been current.  Assigned to messages
  236.      when they come from an inbox file, and removed when a message is
  237.      made current.
  238. `deleted'
  239.      Means the message is deleted.  Assigned by deletion commands and
  240.      removed by undeletion commands (*note Rmail Deletion::.).
  241. `filed'
  242.      Means the message has been copied to some other file.  Assigned
  243.      by the file output commands (*note Rmail Files::.).
  244. `answered'
  245.      Means you have mailed an answer to the message.  Assigned by the
  246.      `r' command (`rmail-reply').  *Note Rmail Reply::.
  247. `forwarded'
  248.      Means you have forwarded the message to other users.  Assigned by
  249.      the `f' command (`rmail-forward').  *Note Rmail Reply::.
  250. `edited'
  251.      Means you have edited the text of the message within Rmail. 
  252.      *Note Rmail Editing::.
  253.    All other labels are assigned or removed only by the user, and it
  254. is up to the user to decide what they mean.
  255. File: emacs,  Node: Rmail Summary,  Next: Rmail Reply,  Prev: Rmail Labels,  Up: Rmail
  256. Summaries
  257. =========
  258.    A "summary" is a buffer containing one line per message that Rmail
  259. can make and display to give you an overview of the mail in an Rmail
  260. file.  Each line shows the message number, the sender, the labels, and
  261. the subject.  When the summary buffer is selected, various commands
  262. can be used to select messages by moving in the summary buffer, or
  263. delete or undelete messages.
  264.    A summary buffer applies to a single Rmail file only; if you are
  265. editing multiple Rmail files, they have separate summary buffers.  The
  266. summary buffer name is made by appending `-summary' to the Rmail
  267. buffer's name.  Only one summary buffer will be displayed at a time
  268. unless you make several windows and select the summary buffers by hand.
  269. * Menu:
  270. * Rmail Make Summary::  Making various sorts of summaries.
  271. * Rmail Summary Edit::  Manipulating messages from the summary.
  272. File: emacs,  Node: Rmail Make Summary,  Next: Rmail Summary Edit,  Prev: Rmail Summary,  Up: Rmail Summary
  273. Making Summaries
  274. ----------------
  275.    Here are the commands to create a summary for the current Rmail
  276. file.  Summaries do not update automatically; to make an updated
  277. summary, you must use one of these commands again.
  278. `C-M-h'
  279.      Summarize all messages (`rmail-summary').
  280. `l LABELS RET'
  281. `C-M-l LABELS RET'
  282.      Summarize message that have one or more of the specified labels
  283.      (`rmail-summary-by-labels').
  284. `C-M-r RCPTS RET'
  285.      Summarize messages that have one or more of the specified
  286.      recipients (`rmail-summary-by-recipients')
  287.    The `h' or `C-M-h' (`rmail-summary') command fills the summary
  288. buffer for the current Rmail file with a summary of all the messages
  289. in the file.  It then displays and selects the summary buffer in
  290. another window.
  291.    `C-M-l LABELS RET' (`rmail-summary-by-labels') makes a partial
  292. summary mentioning only the messages that have one or more of the
  293. labels LABELS.  LABELS should contain label names separated by commas.
  294.    `C-M-r RCPTS RET' (`rmail-summary-by-recipients') makes a partial
  295. summary mentioning only the messages that have one or more of the
  296. recipients RCPTS.  RCPTS should contain mailing addresses separated by
  297. commas.
  298.    Note that there is only one summary buffer for any Rmail file;
  299. making one kind of summary discards any previously made summary.
  300. File: emacs,  Node: Rmail Summary Edit,  Prev: Rmail Make Summary,  Up: Rmail Summary
  301. Editing in Summaries
  302. --------------------
  303.    Summary buffers are given the major mode Rmail Summary mode, which
  304. provides the following special commands:
  305.      Select the message described by the line that point is on
  306.      (`rmail-summary-goto-msg').
  307. `C-n'
  308.      Move to next line and select its message in Rmail
  309.      (`rmail-summary-next-all').
  310. `C-p'
  311.      Move to previous line and select its message
  312.      (`rmail-summary-previous-all').
  313.      Move to next line, skipping lines saying `deleted', and select its
  314.      message (`rmail-summary-next-msg').
  315.      Move to previous line, skipping lines saying `deleted', and select
  316.      its message (`rmail-summary-previous-msg').
  317.      Delete the current line's message, then do like `n'
  318.      (`rmail-summary-delete-forward').
  319.      Undelete and select this message or the previous deleted message
  320.      in the summary (`rmail-summary-undelete').
  321. `SPC'
  322.      Scroll the other window (presumably Rmail) forward
  323.      (`rmail-summary-scroll-msg-up').
  324. `DEL'
  325.      Scroll the other window backward
  326.      (`rmail-summary-scroll-msg-down').
  327.      Kill the summary window (`rmail-summary-exit').
  328.      Exit Rmail (`rmail-summary-quit').
  329.    The keys `C-n' and `C-p' are modified in Rmail Summary mode so that
  330. in addition to moving point in the summary buffer they also cause the
  331. line's message to become current in the associated Rmail buffer.  That
  332. buffer is also made visible in another window if it is not already so.
  333.    `n' and `p' are similar to `C-n' and `C-p', but skip lines that say
  334. `message deleted'.  They are like the `n' and `p' keys of Rmail
  335. itself.  Note, however, that in a partial summary these commands move
  336. only among the message listed in the summary.
  337.    The other Emacs cursor motion commands are not changed in Rmail
  338. Summary mode, so it is easy to get the point on a line whose message
  339. is not selected in Rmail.  This can also happen if you switch to the
  340. Rmail window and switch messages there.  To get the Rmail buffer back
  341. in sync with the summary, use the `j' (`rmail-summary-goto-msg')
  342. command, which selects in Rmail the message of the current summary
  343. line.
  344.    Deletion and undeletion can also be done from the summary buffer. 
  345. They always work based on where point is located in the summary
  346. buffer, ignoring which message is selected in Rmail.  `d'
  347. (`rmail-summary-delete-forward') deletes the current line's message,
  348. then moves to the next line whose message is not deleted and selects
  349. that message.  The inverse of this is `u' (`rmail-summary-undelete'),
  350. which moves back (if necessary) to a line whose message is deleted,
  351. undeletes that message, and selects it in Rmail.
  352.    When moving through messages with the summary buffer, it is
  353. convenient to be able to scroll the message while remaining in the
  354. summary window.  The commands SPC (`rmail-summary-scroll-msg-up') and
  355. DEL (`rmail-summary-scroll-msg-down') do this.  They scroll the
  356. message just as those same keys do when the Rmail buffer is selected.
  357.    When you are finished using the summary, type `x'
  358. (`rmail-summary-exit') to kill the summary buffer's window.
  359.    You can also exit Rmail while in the summary.  `q'
  360. (`rmail-summary-quit') kills the summary window, then saves the Rmail
  361. file and switches to another buffer.
  362. File: emacs,  Node: Rmail Reply,  Next: Rmail Editing,  Prev: Rmail Summary,  Up: Rmail
  363. Sending Replies
  364. ===============
  365.    Rmail has several commands that use Mail mode to send outgoing mail. 
  366. *Note Sending Mail::, for information on using Mail mode.  What are
  367. documented here are the special commands of Rmail for entering Mail
  368. mode.  Note that the usual keys for sending mail, `C-x m' and `C-x 4
  369. m', are available in Rmail mode and work just as they usually do.
  370.      Send a message (`rmail-mail').
  371.      Continue editing already started outgoing message 
  372.      (`rmail-continue').
  373.      Send a reply to the current Rmail message (`rmail-reply').
  374.      Forward current message to other users (`rmail-forward').
  375.    The most common reason to send a message while in Rmail is to reply
  376. to the message you are reading.  To do this, type `r' (`rmail-reply').
  377.  This displays the `*mail*' buffer in another window, much like `C-x 4
  378. m', but preinitializes the `Subject', `To', `CC' and `In-reply-to'
  379. header fields based on the message being replied to.  The `To' field
  380. is given the sender of that message, and the `CC' gets all the
  381. recipients of that message (but recipients that match elements of the
  382. list `rmail-dont-reply-to' are omitted; by default, this list contains
  383. your own mailing address).
  384.    Once you have initialized the `*mail*' buffer this way, sending the
  385. mail goes as usual (*note Sending Mail::.).  You can edit the
  386. presupplied header fields if they are not right for you.
  387.    One additional Mail mode command is available when mailing is
  388. invoked from Rmail: `C-c C-y' (`mail-yank-original') inserts into the
  389. outgoing message a copy of the current Rmail message; normally this is
  390. the message you are replying to, but you can also switch to the Rmail
  391. buffer, select a different message, switch back, and yank new current
  392. message.  Normally the yanked message is indented four spaces and has
  393. most header fields deleted from it; an argument to `C-c C-y' specifies
  394. the amount to indent, and `C-u C-c C-y' does not indent at all and
  395. does not delete any header fields.
  396.    Another frequent reason to send mail in Rmail is to forward the
  397. current message to other users.  `f' (`rmail-forward') makes this easy
  398. by preinitializing the `*mail*' buffer with the current message as the
  399. text, and a subject designating a forwarded message.  All you have to
  400. do is fill in the recipients and send.
  401.    The `m' (`rmail-mail') command is used to start editing an outgoing
  402. message that is not a reply.  It leaves the header fields empty.  Its
  403. only difference from `C-x 4 m' is that it makes the Rmail buffer
  404. accessible for `C-c y', just as `r' does.  Thus, `m' can be used to
  405. reply to or forward a message; it can do anything `r' or `f' can do.
  406.    The `c' (`rmail-continue') command resumes editing the `*mail*'
  407. buffer, to finish editing an outgoing message you were already
  408. composing, or to alter a message you have sent.
  409. File: emacs,  Node: Rmail Editing,  Next: Rmail Digest,  Prev: Rmail Reply,  Up: Rmail
  410. Editing Within a Message
  411. ========================
  412.    Rmail mode provides a few special commands for moving within and
  413. editing the current message.  In addition, the usual Emacs commands
  414. are available (except for a few, such as `C-M-n' and `C-M-h', that are
  415. redefined by Rmail for other purposes).  However, the Rmail buffer is
  416. normally read-only, and to alter it you must use the Rmail command `w'
  417. described below.
  418.      Toggle display of original headers (`rmail-toggle-headers').
  419.      Edit current message (`rmail-edit-current-message').
  420.    Rmail reformats the header of each message before displaying it. 
  421. Normally this involves deleting most header fields, on the grounds that
  422. they are not interesting.  The variable `rmail-ignored-headers' should
  423. contain a regexp that matches the header fields to discard in this way. 
  424. The original headers are saved permanently, and to see what they look
  425. like, use the `t' (`rmail-toggle-headers') command.  This discards the
  426. reformatted headers of the current message and displays it with the
  427. original headers.  Repeating `t' reformats the message again. 
  428. Selecting the message again also reformats.
  429.    The Rmail buffer is normally read only, and most of the characters
  430. you would type to modify it (including most letters) are redefined as
  431. Rmail commands.  This is usually not a problem since it is rare to
  432. want to change the text of a message.  When you do want to do this,
  433. the way is to type `w' (`rmail-edit-current-message'), which changes
  434. from Rmail mode into Rmail Edit mode, another major mode which is
  435. nearly the same as Text mode.  The mode line illustrates this change.
  436.    In Rmail Edit mode, letters insert themselves as usual and the Rmail
  437. commands are not available.  When you are finished editing the message
  438. and are ready to go back to Rmail, type `C-c C-c', which switches back
  439. to Rmail mode.  Alternatively, you can return to Rmail mode but cancel
  440. all the editing that you have done by typing `C-c C-]'.
  441.    Entering Rmail Edit mode calls with no arguments the value of the
  442. variable `text-mode-hook', if that value exists and is not `nil'; then
  443. it does the same with the variable `rmail-edit-mode-hook'.  It adds the
  444. attribute `edited' to the message.
  445. File: emacs,  Node: Rmail Digest,  Prev: Rmail Editing,  Up: Rmail
  446. Digest Messages
  447. ===============
  448.    A "digest message" is a message which exists to contain and carry
  449. several other messages.  Digests are used on moderated mailing lists;
  450. all the messages that arrive for the list during a period of time such
  451. as one day are put inside a single digest which is then sent to the
  452. subscribers.  Transmitting the single digest uses much less computer
  453. time than transmitting the individual messages even though the total
  454. size is the same, because the per-message overhead in network mail
  455. transmission is considerable.
  456.    When you receive a digest message, the most convenient way to read
  457. it is to "undigestify" it: to turn it back into many individual
  458. messages.  Then you can read and delete the individual messages as it
  459. suits you.
  460.    To undigestify a message, select it and then type `M-x
  461. undigestify-rmail-message'.  This copies each submessage as a separate
  462. Rmail message and inserts them all following the digest.  The digest
  463. message itself is flagged as deleted.
  464. File: emacs,  Node: Recursive Edit,  Next: Narrowing,  Prev: Rmail,  Up: Top
  465. Recursive Editing Levels
  466. ========================
  467.    A "recursive edit" is a situation in which you are using Emacs
  468. commands to perform arbitrary editing while in the middle of another
  469. Emacs command.  For example, when you type `C-r' inside of a
  470. `query-replace', you enter a recursive edit in which you can change
  471. the current buffer.  On exiting from the recursive edit, you go back
  472. to the `query-replace'.
  473.    "Exiting" the recursive edit means returning to the unfinished
  474. command, which continues execution.  For example, exiting the recursive
  475. edit requested by `C-r' in `query-replace' causes query replacing to
  476. resume.  Exiting is done with `C-M-c' (`exit-recursive-edit').
  477.    You can also "abort" the recursive edit.  This is like exiting, but
  478. also quits the unfinished command immediately.  Use the command `C-]'
  479. (`abort-recursive-edit') for this.  *Note Quitting::.
  480.    The mode line shows you when you are in a recursive edit by
  481. displaying square brackets around the parentheses that always surround
  482. the major and minor mode names.  Every window's mode line shows this,
  483. in the same way, since being in a recursive edit is true of Emacs as a
  484. whole rather than any particular buffer.
  485.    It is possible to be in recursive edits within recursive edits.  For
  486. example, after typing `C-r' in a `query-replace', you might type a
  487. command that entered the debugger.  In such circumstances, two or more
  488. sets of square brackets appear in the mode line.  Exiting the inner
  489. recursive edit (such as, with the debugger `c' command) would resume
  490. the command where it called the debugger.  After the end of this
  491. command, you would be able to exit the first recursive edit.  Aborting
  492. also gets out of only one level of recursive edit; it returns
  493. immediately to the command level of the previous recursive edit.  So
  494. you could immediately abort that one too.
  495.    Alternatively, the command `M-x top-level' aborts all levels of
  496. recursive edits, returning immediately to the top level command reader.
  497.    The text being edited inside the recursive edit need not be the
  498. same text that you were editing at top level.  It depends on what the
  499. recursive edit is for.  If the command that invokes the recursive edit
  500. selects a different buffer first, that is the buffer you will edit
  501. recursively.  In any case, you can switch buffers within the recursive
  502. edit in the normal manner (as long as the buffer-switching keys have
  503. not been rebound).  You could probably do all the rest of your editing
  504. inside the recursive edit, visiting files and all.  But this could
  505. have surprising effects (such as stack overflow) from time to time. 
  506. So remember to exit or abort the recursive edit when you no longer
  507. need it.
  508.    In general, GNU Emacs tries to avoid using recursive edits.  It is
  509. usually preferable to allow the user to switch among the possible
  510. editing modes in any order he likes.  With recursive edits, the only
  511. way to get to another state is to go "back" to the state that the
  512. recursive edit was invoked from.
  513. File: emacs,  Node: Narrowing,  Next: Sorting,  Prev: Recursive Edit,  Up: Top
  514. Narrowing
  515. =========
  516.    "Narrowing" means focusing in on some portion of the buffer, making
  517. the rest temporarily invisible and inaccessible.  Cancelling the
  518. narrowing, and making the entire buffer once again visible, is called
  519. "widening".  The amount of narrowing in effect in a buffer at any time
  520. is called the buffer's "restriction".
  521. `C-x n'
  522.      Narrow down to between point and mark (`narrow-to-region').
  523. `C-x w'
  524.      Widen to make the entire buffer visible again (`widen').
  525.    When you have narrowed down to a part of the buffer, that part
  526. appears to be all there is.  You can't see the rest, you can't move
  527. into it (motion commands won't go outside the visible part), you can't
  528. change it in any way.  However, it is not gone, and if you save the
  529. file all the invisible text will be saved.  In addition to sometimes
  530. making it easier to concentrate on a single subroutine or paragraph by
  531. eliminating clutter, narrowing can be used to restrict the range of
  532. operation of a replace command or repeating keyboard macro.  The word
  533. `Narrow' appears in the mode line whenever narrowing is in effect.
  534.    The primary narrowing command is `C-x n' (`narrow-to-region').  It
  535. sets the current buffer's restrictions so that the text in the current
  536. region remains visible but all text before the region or after the
  537. region is invisible.  Point and mark do not change.
  538.    Because narrowing can easily confuse users who do not understand it,
  539. `narrow-to-region' is normally a disabled command.  Attempting to use
  540. this command asks for confirmation and gives you the option of
  541. enabling it; once you enable the command, confirmation will no longer
  542. be required for it.  *Note Disabling::.
  543.    The way to undo narrowing is to widen with `C-x w' (`widen').  This
  544. makes all text in the buffer accessible again.
  545.    You can get information on what part of the buffer you are narrowed
  546. down to using the `C-x =' command.  *Note Position Info::.
  547. File: emacs,  Node: Sorting,  Next: Shell,  Prev: Narrowing,  Up: Top
  548. Sorting Text
  549. ============
  550.    Emacs provides several commands for sorting text in the buffer.  All
  551. operate on the contents of the region (the text between point and the
  552. mark).  They divide the text of the region into many "sort records",
  553. identify a "sort key" for each record, and then reorder the records
  554. into the order determined by the sort keys.  The records are ordered so
  555. that their keys are in alphabetical order, or, for numeric sorting, in
  556. numeric order.  In alphabetic sorting, all upper case letters `A'
  557. through `Z' come before lower case `a', in accord with the ASCII
  558. character sequence.
  559.    The various sort commands differ in how they divide the text into
  560. sort records and in which part of each record is used as the sort key.
  561.  Most of the commands make each line a separate sort record, but some
  562. commands use paragraphs or pages as sort records.  Most of the sort
  563. commands use each entire sort record as its own sort key, but some use
  564. only a portion of the record as the sort key.
  565. `M-x sort-lines'
  566.      Divide the region into lines, and sort by comparing the entire
  567.      text of a line.  A prefix argument means sort into descending
  568.      order.
  569. `M-x sort-paragraphs'
  570.      Divide the region into paragraphs, and sort by comparing the
  571.      entire text of a paragraph (except for leading blank lines).  A
  572.      prefix argument means sort into descending order.
  573. `M-x sort-pages'
  574.      Divide the region into pages, and sort by comparing the entire
  575.      text of a page (except for leading blank lines).  A prefix
  576.      argument means sort into descending order.
  577. `M-x sort-fields'
  578.      Divide the region into lines, and sort by comparing the contents
  579.      of one field in each line.  Fields are defined as separated by
  580.      whitespace, so the first run of consecutive non-whitespace
  581.      characters in a line constitutes field 1, the second such run
  582.      constitutes field 2, etc.
  583.      You specify which field to sort by with a numeric argument: 1 to
  584.      sort by field 1, etc.  A negative argument means sort into
  585.      descending order.  Thus, minus 2 means sort by field 2 in
  586.      reverse-alphabetical order.
  587. `M-x sort-numeric-fields'
  588.      Like `M-x sort-fields' except the specified field is converted to
  589.      a number for each line, and the numbers are compared.  `10' comes
  590.      before `2' when considered as text, but after it when considered
  591.      as a number.
  592. `M-x sort-columns'
  593.      Like `M-x sort-fields' except that the text within each line used
  594.      for comparison comes from a fixed range of columns.  See below
  595.      for an explanation.
  596.    For example, if the buffer contains
  597.      On systems where clash detection (locking of files being edited) is
  598.      implemented, Emacs also checks the first time you modify a buffer
  599.      whether the file has changed on disk since it was last visited or
  600.      saved.  If it has, you are asked to confirm that you want to change
  601.      the buffer.
  602. then if you apply `M-x sort-lines' to the entire buffer you get
  603.      On systems where clash detection (locking of files being edited) is
  604.      implemented, Emacs also checks the first time you modify a buffer
  605.      saved.  If it has, you are asked to confirm that you want to change
  606.      the buffer.
  607.      whether the file has changed on disk since it was last visited or
  608. where the upper case `O' comes before all lower case letters.  If you
  609. apply instead `C-u 2 M-x sort-fields' you get
  610.      implemented, Emacs also checks the first time you modify a buffer
  611.      saved.  If it has, you are asked to confirm that you want to change
  612.      the buffer.
  613.      On systems where clash detection (locking of files being edited) is
  614.      whether the file has changed on disk since it was last visited or
  615. where the sort keys were `Emacs', `If', `buffer', `systems' and `the'.
  616.    `M-x sort-columns' requires more explanation.  You specify the
  617. columns by putting point at one of the columns and the mark at the
  618. other column.  Because this means you cannot put point or the mark at
  619. the beginning of the first line to sort, this command uses an unusual
  620. definition of `region': all of the line point is in is considered part
  621. of the region, and so is all of the line the mark is in.
  622.    For example, to sort a table by information found in columns 10 to
  623. 15, you could put the mark on column 10 in the first line of the
  624. table, and point on column 15 in the last line of the table, and then
  625. use this command.  Or you could put the mark on column 15 in the first
  626. line and point on column 10 in the last line.
  627.    This can be thought of as sorting the rectangle specified by point
  628. and the mark, except that the text on each line to the left or right
  629. of the rectangle moves along with the text inside the rectangle. 
  630. *Note Rectangles::.
  631. File: emacs,  Node: Shell,  Next: Hardcopy,  Prev: Sorting,  Up: Top
  632. Running Shell Commands from Emacs
  633. =================================
  634.    Emacs has commands for passing single command lines to inferior
  635. shell processes; it can also run a shell interactively with input and
  636. output to an Emacs buffer `*shell*'.
  637. `M-!'
  638.      Run a specified shell command line and display the output
  639.      (`shell-command').
  640. `M-|'
  641.      Run a specified shell command line with region contents as input;
  642.      optionally replace the region with the output
  643.      (`shell-command-on-region').
  644. `M-x shell'
  645.      Run a subshell with input and output through an Emacs buffer. 
  646.      You can then give commands interactively.
  647. * Menu:
  648. * Single Shell::         How to run one shell command and return.
  649. * Interactive Shell::    Permanent shell taking input via Emacs.
  650. * Shell Mode::           Special Emacs commands used with permanent shell.
  651. File: emacs,  Node: Single Shell,  Next: Interactive Shell,  Prev: Shell,  Up: Shell
  652. Single Shell Commands
  653. ---------------------
  654.    `M-!' (`shell-command') reads a line of text using the minibuffer
  655. and creates an inferior shell to execute the line as a command. 
  656. Standard input from the command comes from the null device.  If the
  657. shell command produces any output, the output goes into an Emacs
  658. buffer named `*Shell Command Output*', which is displayed in another
  659. window but not selected.  A numeric argument, as in `M-1 M-!', directs
  660. this command to insert any output into the current buffer.  In that
  661. case, point is left before the output and the mark is set after the
  662. output.
  663.    `M-|' (`shell-command-on-region') is like `M-!' but passes the
  664. contents of the region as input to the shell command, instead of no
  665. input.  If a numeric argument is used, meaning insert output in the
  666. current buffer, then the old region is deleted first and the output
  667. replaces it as the contents of the region.
  668.    Both `M-!' and `M-|' use `shell-file-name' to specify the shell to
  669. use.  This variable is initialized based on your `SHELL' environment
  670. variable when Emacs is started.  If the file name does not specify a
  671. directory, the directories in the list `exec-path' are searched; this
  672. list is initialized based on the environment variable `PATH' when
  673. Emacs is started.  Your `.emacs' file can override either or both of
  674. these default initializations.
  675.    With `M-!' and `M-|', Emacs has to wait until the shell command
  676. completes.  You can quit with `C-g'; that terminates the shell command.
  677. File: emacs,  Node: Interactive Shell,  Next: Shell Mode,  Prev: Single Shell,  Up: Shell
  678. Interactive Inferior Shell
  679. --------------------------
  680.    To run a subshell interactively, putting its typescript in an Emacs
  681. buffer, use `M-x shell'.  This creates (or reuses) a buffer named
  682. `*shell*' and runs a subshell with input coming from and output going
  683. to that buffer.  That is to say, any "terminal output" from the
  684. subshell will go into the buffer, advancing point, and any "terminal
  685. input" for the subshell comes from text in the buffer.  To give input
  686. to the subshell, go to the end of the buffer and type the input,
  687. terminated by RET.
  688.    Emacs does not wait for the subshell to do anything.  You can switch
  689. windows or buffers and edit them while the shell is waiting, or while
  690. it is running a command.  Output from the subshell waits until Emacs
  691. has time to process it; this happens whenever Emacs is waiting for
  692. keyboard input or for time to elapse.
  693.    If you would like multiple subshells, change the name of buffer
  694. `*shell*' to something different by using `M-x rename-buffer'.  The
  695. next use of `M-x shell' will create a new buffer `*shell*' with its
  696. own subshell.  By renaming this buffer as well you can create a third
  697. one, and so on.  All the subshells run independently and in parallel.
  698.    The file name used to load the subshell is the value of the variable
  699. `explicit-shell-file-name', if that is non-`nil'.  Otherwise, the
  700. environment variable `ESHELL' is used, or the environment variable
  701. `SHELL' if there is no `ESHELL'.  If the file name specified is
  702. relative, the directories in the list `exec-path' are searched (*note
  703. Single Shell Commands: Single Shell.).
  704.    As soon as the subshell is started, it is sent as input the
  705. contents of the file `~/.emacs_SHELLNAME', if that file exists, where
  706. SHELLNAME is the name of the file that the shell was loaded from.  For
  707. example, if you use `csh', the file sent to it is `~/.emacs_csh'.
  708.    `cd', `pushd' and `popd' commands given to the inferior shell are
  709. watched by Emacs so it can keep the `*shell*' buffer's default
  710. directory the same as the shell's working directory.  These commands
  711. are recognized syntactically by examining lines of input that are
  712. sent.  If you use aliases for these commands, you can tell Emacs to
  713. recognize them also.  For example, if the value of the variable
  714. `shell-pushd-regexp' matches the beginning of a shell command line,
  715. that line is regarded as a `pushd' command.  Change this variable when
  716. you add aliases for `pushd'.  Likewise, `shell-popd-regexp' and
  717. `shell-cd-regexp' are used to recognize commands with the meaning of
  718. `popd' and `cd'.  These commands are recognized only at the beginning
  719. of a shell command line.
  720.    If Emacs gets an error while trying to handle what it believes is a
  721. `cd', `pushd' or `popd' command, and the value of
  722. `shell-set-directory-error-hook' is non-`nil', that value is called as
  723. a function with no arguments.
  724. File: emacs,  Node: Shell Mode,  Prev: Interactive Shell,  Up: Shell
  725. Shell Mode
  726. ----------
  727.    The shell buffer uses Shell mode, which defines several special keys
  728. attached to the `C-c' prefix.  They are chosen to resemble the usual
  729. editing and job control characters present in shells that are not under
  730. Emacs, except that you must type `C-c' first.  Here is a complete list
  731. of the special key bindings of Shell mode:
  732. `RET'
  733.      At end of buffer send line as input; otherwise, copy current line
  734.      to end of buffer and send it (`send-shell-input').  When a line
  735.      is copied, any text at the beginning of the line that matches the
  736.      variable `shell-prompt-pattern' is left out; this variable's
  737.      value should be a regexp string that matches the prompts that you
  738.      use in your subshell.
  739. `C-c C-d'
  740.      Send end-of-file as input, probably causing the shell or its
  741.      current subjob to finish (`shell-send-eof').
  742. `C-c C-u'
  743.      Kill all text that has yet to be sent as input
  744.      (`kill-shell-input').
  745. `C-c C-w'
  746.      Kill a word before point (`backward-kill-word').
  747. `C-c C-c'
  748.      Interrupt the shell or its current subjob if any
  749.      (`interrupt-shell-subjob').
  750. `C-c C-z'
  751.      Stop the shell or its current subjob if any (`stop-shell-subjob').
  752. `C-c C-\'
  753.      Send quit signal to the shell or its current subjob if any
  754.      (`quit-shell-subjob').
  755. `C-c C-o'
  756.      Delete last batch of output from shell (`kill-output-from-shell').
  757. `C-c C-r'
  758.      Scroll top of last batch of output to top of window
  759.      (`show-output-from-shell').
  760. `C-c C-y'
  761.      Copy the previous bunch of shell input, and insert it into the
  762.      buffer before point (`copy-last-shell-input').  No final newline
  763.      is inserted, and the input copied is not resubmitted until you
  764.      type RET.
  765. File: emacs,  Node: Hardcopy,  Next: Dissociated Press,  Prev: Shell,  Up: Top
  766. Hardcopy Output
  767. ===============
  768.    The Emacs commands for making hardcopy derive their names from the
  769. Unix commands `print' and `lpr'.
  770. `M-x print-buffer'
  771.      Print hardcopy of current buffer using Unix command `print' (`lpr
  772.      -p').  This makes page headings containing the file name and page
  773.      number.
  774. `M-x lpr-buffer'
  775.      Print hardcopy of current buffer using Unix command `lpr'.  This
  776.      makes no page headings.
  777. `M-x print-region'
  778.      Like `print-buffer' but prints only the current region.
  779. `M-x lpr-region'
  780.      Like `lpr-buffer' but prints only the current region.
  781.    All the hardcopy commands pass extra switches to the `lpr' program
  782. based on the value of the variable `lpr-switches'.  Its value should
  783. be a list of strings, each string a switch starting with `-'.  For
  784. example, the value could be `("-Pfoo")' to print on printer `foo'.
  785. File: emacs,  Node: Dissociated Press,  Next: Amusements,  Prev: Hardcopy,  Up: Top
  786. Dissociated Press
  787. =================
  788.    `M-x dissociated-press' is a command for scrambling a file of text
  789. either word by word or character by character.  Starting from a buffer
  790. of straight English, it produces extremely amusing output.  The input
  791. comes from the current Emacs buffer.  Dissociated Press writes its
  792. output in a buffer named `*Dissociation*', and redisplays that buffer
  793. after every couple of lines (approximately) to facilitate reading it.
  794.    `dissociated-press' asks every so often whether to continue
  795. operating.  Answer `n' to stop it.  You can also stop at any time by
  796. typing `C-g'.  The dissociation output remains in the `*Dissociation*'
  797. buffer for you to copy elsewhere if you wish.
  798.    Dissociated Press operates by jumping at random from one point in
  799. the buffer to another.  In order to produce plausible output rather
  800. than gibberish, it insists on a certain amount of overlap between the
  801. end of one run of consecutive words or characters and the start of the
  802. next.  That is, if it has just printed out `president' and then
  803. decides to jump to a different point in the file, it might spot the
  804. `ent' in `pentagon' and continue from there, producing
  805. `presidentagon'.  Long sample texts produce the best results.
  806.    A positive argument to `M-x dissociated-press' tells it to operate
  807. character by character, and specifies the number of overlap
  808. characters.  A negative argument tells it to operate word by word and
  809. specifies the number of overlap words.  In this mode, whole words are
  810. treated as the elements to be permuted, rather than characters.  No
  811. argument is equivalent to an argument of two.  For your
  812. againformation, the output goes only into the buffer `*Dissociation*'.
  813.  The buffer you start with is not changed.
  814.    Dissociated Press produces nearly the same results as a Markov chain
  815. based on a frequency table constructed from the sample text.  It is,
  816. however, an independent, ignoriginal invention.  Dissociated Press
  817. techniquitously copies several consecutive characters from the sample
  818. between random choices, whereas a Markov chain would choose randomly
  819. for each word or character.  This makes for more plausible sounding
  820. results, and runs faster.
  821.    It is a mustatement that too much use of Dissociated Press can be a
  822. developediment to your real work.  Sometimes to the point of outragedy. 
  823. And keep dissociwords out of your documentation, if you want it to be
  824. well userenced and properbose.  Have fun.  Your buggestions are
  825. welcome.
  826. File: emacs,  Node: Amusements,  Next: Emulation,  Prev: Dissociated Press,  Up: Top
  827. Other Amusements
  828. ================
  829.    If you are a little bit bored, you can try `M-x hanoi'.  If you are
  830. considerably bored, give it a numeric argument.  If you are very very
  831. bored, try an argument of 9.  Sit back and watch.
  832.    When you are frustrated, try the famous Eliza program.  Just do
  833. `M-x doctor'.  End each input by typing `RET' twice.
  834.    When you are feeling strange, type `M-x yow'.
  835. File: emacs,  Node: Emulation,  Next: Customization,  Prev: Amusements,  Up: Top
  836. Emulation
  837. =========
  838.    GNU Emacs can be programmed to emulate (more or less) most other
  839. editors.  Standard facilities can emulate these:
  840. EDT (DEC VMS editor)
  841.      Turn on EDT emulation with `M-x edt-emulation-on'.  `M-x
  842.      edt-emulation-off' restores normal Emacs command bindings.
  843.      Most of the EDT emulation commands are keypad keys, and most
  844.      standard Emacs key bindings are still available.  The EDT
  845.      emulation rebindings are done in the global keymap, so there is
  846.      no problem switching buffers or major modes while in EDT
  847.      emulation.
  848. Gosling Emacs
  849.      Turn on emulation of Gosling Emacs (aka Unipress Emacs) with `M-x
  850.      set-gosmacs-bindings'.  This redefines many keys, mostly on the
  851.      `C-x' and `ESC' prefixes, to work as they do in Gosmacs.  `M-x
  852.      set-gnu-bindings' returns to normal GNU Emacs by rebinding the
  853.      same keys to the definitions they had at the time `M-x
  854.      set-gosmacs-bindings' was done.
  855.      It is also possible to run Mocklisp code written for Gosling
  856.      Emacs.  *Note Mocklisp::.
  857. vi (Berkeley Unix editor)
  858.      Turn on vi emulation with `M-x vi-mode'.  This is a major mode
  859.      that replaces the previously established major mode.  All of the
  860.      vi commands that, in real vi, enter "input" mode are programmed
  861.      in the Emacs emulator to return to the previous major mode.  Thus,
  862.      ordinary Emacs serves as vi's "input" mode.
  863.      Because vi emulation works through major modes, it does not work
  864.      to switch buffers during emulation.  Return to normal Emacs first.
  865.      If you plan to use vi emulation much, you probably want to bind a
  866.      key to the `vi-mode' command.
  867. vi (alternate emulator)
  868.      Another vi emulator said to resemble real vi more thoroughly is
  869.      invoked by `M-x vip-mode'.  "Input" mode in this emulator is
  870.      changed from ordinary Emacs so you can use ESC to go back to
  871.      emulated vi command mode.  To get from emulated vi command mode
  872.      back to ordinary Emacs, type `C-z'.
  873.      This emulation does not work through major modes, and it is
  874.      possible to switch buffers in various ways within the emulator. 
  875.      It is not so necessary to assign a key to the command `vip-mode'
  876.      as it is with `vi-mode' because terminating insert mode does not
  877.      use it.
  878.      For full information, see the long comment at the beginning of the
  879.      source file, which is `lisp/vip.el' in the Emacs distribution.
  880.    I am interested in hearing which vi emulator users prefer, as well
  881. as in receiving more complete user documentation for either or both
  882. emulators.  Warning: loading both at once may cause name conficts; no
  883. one has checked.
  884.